<?php
import('@.Include.Common');


// 本类由系统自动生成，仅供测试用途
class MemberAction extends Action{
    public function index(){
        header("Content-Type:text/html; charset=utf-8");
        echo "<div style='font-weight:normal;color:blue;float:left;width:345px;text-align:center;border:1px solid silver;background:#E8EFFF;padding:8px;font-size:14px;font-family:Tahoma'>^_^ Hello,欢迎使用<span style='font-weight:bold;color:red'>ThinkPHP</span></div>";
    }
	
	public function register()
	{
		$this->display();
	}

	public function add()
	{
		$common = new Common;
		$member = new MemberModel();
		$member->email = $_POST['email'];
		$member->password = $_POST['password'];
		$member->nickname = $_POST['nickName'];
		$member->regip = get_client_ip();
		$member->regdate = time();
		//$vo = $member->create($member);
		if($member->create($member))
		{
		//echo $common->test();
			$member->add();
			$common->redirect($this,"注册成功！","首页","Member/register",2);
			$this->display("message");
		}
		else
		{
			$this->assign('message',$member->getError());
			$this->display("message");
		}
	}
}
?>